<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MODULE_IMAGE:  Fichier source de /home/radius/Documents/Rachid_Licence/LIF7/LIF7_TD1/module-image/src/Pixel.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Généré par Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Page&nbsp;principale</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li><a href="dirs.html"><span>Répertoires</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Liste&nbsp;des&nbsp;fichiers</span></a></li>
      <li><a href="globals.html"><span>Membres&nbsp;de&nbsp;fichier</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_53790bda95882cd03745840c1cece42e.html">src</a>
  </div>
</div>
<div class="contents">
<h1>Pixel.c</h1><a href="_pixel_8c.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;<a class="code" href="_pixel_8h.html" title="Fichier d&amp;#39;entête du module Pixel.">Pixel.h</a>&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;<a class="code" href="_image_8h.html" title="Fichier d&amp;#39;entête du module Image.">Image.h</a>&quot;</span>
<a name="l00010"></a>00010 <span class="comment">/* ********************************************************************* */</span>
<a name="l00011"></a>00011 <span class="comment">/*                                                                       */</span>
<a name="l00012"></a>00012 <span class="comment">/*              acceseurs et mutateurs du module pixels                  */</span>
<a name="l00013"></a>00013 <span class="comment">/*                                                                       */</span>
<a name="l00014"></a>00014 <span class="comment">/* ********************************************************************* */</span>
<a name="l00015"></a>00015 
<a name="l00016"></a><a class="code" href="_pixel_8h.html#a5471e543f4cc0813d3f55bfb3b832aab">00016</a> <span class="keywordtype">int</span> <a class="code" href="_pixel_8c.html#a5471e543f4cc0813d3f55bfb3b832aab" title="Récupère la valeur rouge du pixel seléctioné en vérifiant sa validité.">getPixelRouge</a>(<span class="keyword">const</span> <a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>) 
<a name="l00017"></a>00017 {
<a name="l00018"></a>00018   <span class="keywordtype">int</span> res ;
<a name="l00019"></a>00019   assert(pix != NULL) ;
<a name="l00020"></a>00020   res = pix-&gt;r ;
<a name="l00021"></a>00021   <span class="keywordflow">return</span> res ;
<a name="l00022"></a>00022 }
<a name="l00023"></a>00023 
<a name="l00024"></a><a class="code" href="_pixel_8h.html#a6c2af2c126bf976cf1fcae1468751136">00024</a> <span class="keywordtype">int</span> <a class="code" href="_pixel_8c.html#a6c2af2c126bf976cf1fcae1468751136" title="Récupère la valeur vert du pixel seléctioné en vérifiant sa validité.">getPixelVert</a>(<span class="keyword">const</span> <a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>) 
<a name="l00025"></a>00025 {
<a name="l00026"></a>00026   <span class="keywordtype">int</span> res ;
<a name="l00027"></a>00027   assert(pix != NULL) ;
<a name="l00028"></a>00028   res = pix-&gt;v ;
<a name="l00029"></a>00029 
<a name="l00030"></a>00030   <span class="keywordflow">return</span> res ;
<a name="l00031"></a>00031 }
<a name="l00032"></a>00032 
<a name="l00033"></a><a class="code" href="_pixel_8h.html#ab7a79cdabd54437de309e4c68963df93">00033</a> <span class="keywordtype">int</span> <a class="code" href="_pixel_8c.html#ab7a79cdabd54437de309e4c68963df93" title="Récupère la valeur bleu du pixel seléctioné en vérifiant sa validité.">getPixelBleu</a>(<span class="keyword">const</span> <a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>) 
<a name="l00034"></a>00034 {
<a name="l00035"></a>00035   <span class="keywordtype">int</span> res ;
<a name="l00036"></a>00036   assert(pix != NULL) ;
<a name="l00037"></a>00037   res = pix-&gt;b ;
<a name="l00038"></a>00038 
<a name="l00039"></a>00039   <span class="keywordflow">return</span> res ;
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a><a class="code" href="_pixel_8h.html#a00e0da74bcf1a9b8599f82d9e84d63e6">00042</a> <span class="keywordtype">void</span> <a class="code" href="_pixel_8c.html#afc402bc403f330f308524d0160e056ad" title="Modifie la valeur rouge du pixel seléctioné en vérifiant sa validité.">setPixelRouge</a>(<a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, <span class="keywordtype">int</span> valeur) 
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044   assert(pix != NULL) ;
<a name="l00045"></a>00045   assert((valeur &gt;= 0) &amp;&amp; (valeur &lt;= 255)) ;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047   pix-&gt;r = valeur ;
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="_pixel_8h.html#ac5b87bbdb69160e5962378a87bea2314">00050</a> <span class="keywordtype">void</span> <a class="code" href="_pixel_8c.html#ac7e725830492bba904bb3146341599b9" title="Modifie la valeur vert du pixel seléctioné en vérifiant sa validité.">setPixelVert</a>(<a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, <span class="keywordtype">int</span> valeur) 
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052   assert(pix != NULL) ;
<a name="l00053"></a>00053   assert((valeur &gt;= 0) &amp;&amp; (valeur &lt;= 255)) ;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055   pix-&gt;v = valeur ;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 
<a name="l00058"></a><a class="code" href="_pixel_8h.html#a6015241c665c4ec97539631a443198bd">00058</a> <span class="keywordtype">void</span> <a class="code" href="_pixel_8c.html#a2ab00dd32000e4e3bc0874060d806617" title="Modifie la valeur bleu du pixel seléctioné en vérifiant sa validité.">setPixelBleu</a>(<a class="code" href="struct_pixel.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Pixel</a> *<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, <span class="keywordtype">int</span> valeur) 
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060   assert(pix != NULL) ;
<a name="l00061"></a>00061   assert((valeur &gt;= 0) &amp;&amp; (valeur &lt;= 255)) ;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063   pix-&gt;b = valeur ;
<a name="l00064"></a>00064 }
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="comment">/* ********************************************************************* */</span>
<a name="l00067"></a>00067 <span class="comment">/*                                                                       */</span>
<a name="l00068"></a>00068 <span class="comment">/*                 Test de Regression du module Pixel                    */</span>
<a name="l00069"></a>00069 <span class="comment">/*                                                                       */</span>
<a name="l00070"></a>00070 <span class="comment">/* ********************************************************************* */</span>
<a name="l00071"></a>00071 
<a name="l00072"></a><a class="code" href="_pixel_8h.html#a55edb1ee783f4a041094bc2c93986b54">00072</a> <span class="keywordtype">void</span> <a class="code" href="_pixel_8c.html#a55edb1ee783f4a041094bc2c93986b54" title="Teste toutes les fonctions du module Pixel.h.">ImRegressionTest2</a>()
<a name="l00073"></a>00073 {
<a name="l00074"></a>00074         <a class="code" href="structs_image.html" title="Structure utilisée pour la gestion d&amp;#39;une image.">Image</a> *im ;
<a name="l00075"></a>00075 
<a name="l00076"></a>00076         printf(<span class="stringliteral">&quot;\nTEST DE REGRESSION DU MODULE PIXEL\n&quot;</span>) ;
<a name="l00077"></a>00077         <span class="comment">/* Test des accesseurs et mutateurs du module Pixel */</span>
<a name="l00078"></a>00078         
<a name="l00079"></a>00079         printf(<span class="stringliteral">&quot;\nTest des mutateurs et accesseurs du module Pixel\n&quot;</span>) ;
<a name="l00080"></a>00080         printf(<span class="stringliteral">&quot;\nCréation d&apos;une image à 1 pixel : &quot;</span>) ;
<a name="l00081"></a>00081         im = <a class="code" href="_image_8c.html#a13ab11befc99f60ea0a5255e22f7f2be" title="Alloue dans le tas une structure Image puis l&amp;#39;initialise avec imInit.">imCreer</a>(1,1) ;
<a name="l00082"></a>00082         printf(<span class="stringliteral">&quot;ok.\n&quot;</span>) ;
<a name="l00083"></a>00083         printf(<span class="stringliteral">&quot;modification des valeurs du pixel à 255 : &quot;</span>) ;
<a name="l00084"></a>00084         <a class="code" href="_pixel_8c.html#afc402bc403f330f308524d0160e056ad" title="Modifie la valeur rouge du pixel seléctioné en vérifiant sa validité.">setPixelRouge</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, 255) ;
<a name="l00085"></a>00085         <a class="code" href="_pixel_8c.html#ac7e725830492bba904bb3146341599b9" title="Modifie la valeur vert du pixel seléctioné en vérifiant sa validité.">setPixelVert</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, 255) ;
<a name="l00086"></a>00086         <a class="code" href="_pixel_8c.html#a2ab00dd32000e4e3bc0874060d806617" title="Modifie la valeur bleu du pixel seléctioné en vérifiant sa validité.">setPixelBleu</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>, 255) ;
<a name="l00087"></a>00087         printf(<span class="stringliteral">&quot;ok.\n&quot;</span>) ;
<a name="l00088"></a>00088         printf(<span class="stringliteral">&quot;Valeurs du pixel aprés modification :\n&quot;</span>) ;
<a name="l00089"></a>00089         printf(<span class="stringliteral">&quot;Rouge : %d\n&quot;</span>,<a class="code" href="_pixel_8c.html#a5471e543f4cc0813d3f55bfb3b832aab" title="Récupère la valeur rouge du pixel seléctioné en vérifiant sa validité.">getPixelRouge</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>)) ;
<a name="l00090"></a>00090         printf(<span class="stringliteral">&quot;Vert : %d\n&quot;</span>,<a class="code" href="_pixel_8c.html#a6c2af2c126bf976cf1fcae1468751136" title="Récupère la valeur vert du pixel seléctioné en vérifiant sa validité.">getPixelVert</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>)) ;
<a name="l00091"></a>00091         printf(<span class="stringliteral">&quot;Bleu : %d\n&quot;</span>,<a class="code" href="_pixel_8c.html#ab7a79cdabd54437de309e4c68963df93" title="Récupère la valeur bleu du pixel seléctioné en vérifiant sa validité.">getPixelBleu</a>(im-&gt;<a class="code" href="structs_image.html#a6951df3303ff6144e7786fe41b056082">pix</a>)) ;
<a name="l00092"></a>00092         printf(<span class="stringliteral">&quot;Test ok.\n&quot;</span>) ;
<a name="l00093"></a>00093 
<a name="l00094"></a>00094         printf(<span class="stringliteral">&quot;Destruction de l&apos;image : &quot;</span>);
<a name="l00095"></a>00095         <a class="code" href="_image_8c.html#ae9d0336b23f7c615e57c4862714df90f" title="Libere le tableau de pixel en appelant imLibere puis détruit la structure image...">imDetruire</a>(im);
<a name="l00096"></a>00096         printf(<span class="stringliteral">&quot;ok.\n&quot;</span>);
<a name="l00097"></a>00097 
<a name="l00098"></a>00098         printf(<span class="stringliteral">&quot;\nTEST DE REGRESSION DU MODULE PIXEL TERMINE.\n\n&quot;</span>) ;
<a name="l00099"></a>00099 
<a name="l00100"></a>00100 }
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Généré le Fri Oct 21 20:06:53 2011 pour MODULE_IMAGE par&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>
